Skip to content

feat: implement more friendly updater errors#1770

Open
nmggithub wants to merge 3 commits intopingdotgg:mainfrom
nmggithub:friendly-update-errors
Open

feat: implement more friendly updater errors#1770
nmggithub wants to merge 3 commits intopingdotgg:mainfrom
nmggithub:friendly-update-errors

Conversation

@nmggithub
Copy link
Copy Markdown
Contributor

@nmggithub nmggithub commented Apr 6, 2026

What Changed

This condenses all our copied update state toasts to a single file, and also allows us to add action buttons to the toast from the Electron main process (over IPC). This makes the code more DRY and also gives users updating a more friendly experience when something goes wrong.

Why

Our update error toasts are unfriendly.

Example: https://x.com/asvirts/status/2040604365040300485

UI Changes

This is an example I made with our mock update server explicitly serving the wrong checksum. That's why it always fails. But you can see the "retry download" button works.

Screen.Recording.2026-04-05.at.23.22.06.mov

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included ~before/~after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk
Changes the desktop auto-update error pipeline end-to-end (Electron main process, IPC contracts, and multiple UI entry points), so regressions could affect update flows and user messaging. Logic is mostly additive and covered by new tests, but it touches a user-critical path.

Overview
Improves desktop auto-update UX by normalizing updater errors into user-friendly messages and optionally attaching a toast action (e.g. Retry download) returned from the Electron main process.

Adds DesktopToastAction and a toastAction field to DesktopUpdateState, propagates it through update state reducers, and wires main.ts to use normalizeDesktopUpdateError() for check/download/install failures and updater error events.

Centralizes web UI update toasts into desktopUpdateToast.ts and replaces duplicated inline toast logic in Sidebar, SidebarUpdatePill, and SettingsPanels, including support for action buttons that trigger the corresponding window.desktopBridge call.

Reviewed by Cursor Bugbot for commit e3fb506. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add user-friendly error messages and retry toast actions to the desktop updater

  • Introduces normalizeDesktopUpdateError in updateErrors.ts to classify raw updater errors (network, checksum/hash mismatch, etc.) into structured objects with a user-facing message, raw message for logging, and an optional DesktopToastAction.
  • Extends DesktopUpdateState in ipc.ts with a toastAction field, and updates all state reducers in updateMachine.ts to carry or clear this field across update lifecycle transitions.
  • Centralizes update toast logic into desktopUpdateToast.ts, replacing inline toast calls in Sidebar, SidebarUpdatePill, and AboutVersionSection with shared helpers that surface action buttons (e.g. retry download) when toastAction is present.
  • On a checksum download failure, users now see a toast with a "Retry Download" button that re-triggers bridge.downloadUpdate().

Macroscope summarized e3fb506.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 188e82d0-ffd9-4394-ad05-81b45d8e63dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 6, 2026

const NETWORK_ERROR_PATTERN =
/\b(EAI_AGAIN|ECONNABORTED|ECONNREFUSED|ECONNRESET|ENETUNREACH|ENOTFOUND|ERR_CONNECTION_(?:CLOSED|REFUSED|RESET|TIMED_OUT)|ERR_INTERNET_DISCONNECTED|ERR_NAME_NOT_RESOLVED|ETIMEDOUT|socket hang up)\b/i;
const CHECKSUM_ERROR_PATTERN =
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit over-engineered, as upstream Electron Updater should only ever have one error message, but this does make our implementation (hopefully) future-proof if they change that error message. We may also be able to key off their ERR_CHECKSUM_MISMATCH code, if we desire.

macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 6, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 6, 2026

Approvability

Verdict: Approved

This PR improves error message presentation for desktop updates by mapping cryptic errors to user-friendly messages and consolidating toast logic. The changes are additive and contained to error handling presentation without modifying core update mechanics. The only open comment is a low-severity dead code finding.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp bot dismissed their stale review April 6, 2026 03:55

Dismissing prior approval to re-evaluate 838ceb4

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e3fb506. Configure here.

return getDesktopUpdateActionError(result) !== null;
}

export function shouldHighlightDesktopUpdateError(state: DesktopUpdateState | null): boolean {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused exported function after removing all callers

Low Severity

shouldToastDesktopUpdateActionResult was removed from all production call sites (Sidebar.tsx and SidebarUpdatePill.tsx) in this PR, but its definition and export in desktopUpdate.logic.ts (and corresponding tests in desktopUpdate.logic.test.ts) were left behind. It's now dead code in production — only referenced by its own test file.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e3fb506. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @juliusmarminge

I may have vibed too hard on this one. Let me know your thoughts on if we should remove this or add it back into the app proper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant